package com.prd.controller;



import com.prd.dto.WorkReportDTO;
import com.prd.service.WorkReportService;
import com.prd.util.JsonData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 工作报告数据表 前端控制器
 * </p>
 *
 * @author lizhaoyi
 * @since 2023-11-06
 */
@Api(tags={"工作报告"})
@RestController
@RequestMapping("/api/workReport")
public class WorkReportController {

    private WorkReportService workReportService;

    public WorkReportController(WorkReportService workReportService) {
        this.workReportService = workReportService;
    }


    @ApiOperation("分页查询工作日报")
    @GetMapping("selectDayReportPage")
    public JsonData selectDayReportPage(@ApiParam(value = "当前页")  @RequestParam(value = "page", defaultValue = "1") int page,
                                        @ApiParam(value = "每页显示多少条") @RequestParam(value = "size", defaultValue = "10") int size){

        return workReportService.selectDayReportPage(page,size);
    }

    @ApiOperation("分页查询工作周报")
    @GetMapping("creatDayReport")
    public JsonData selectWeekReportPage(@ApiParam(value = "当前页")  @RequestParam(value = "page", defaultValue = "1") int page,
                                         @ApiParam(value = "每页显示多少条") @RequestParam(value = "size", defaultValue = "10") int size){

        return workReportService.selectWeekReportPage(page,size);
    }


    @ApiOperation("分页查询工作月报")
    @GetMapping("selectMonthReportPage")
    public JsonData selectMonthReportPage(@ApiParam(value = "当前页")  @RequestParam(value = "page", defaultValue = "1") int page,
                                          @ApiParam(value = "每页显示多少条") @RequestParam(value = "size", defaultValue = "10") int size){

        return workReportService.selectMonthReportPage(page,size);
    }

    @ApiOperation("添加工作日报")
    @PostMapping("creatDayReport")
    public JsonData creatDayReport(@ApiParam(value = "工作报告对象") @RequestBody WorkReportDTO workReportDTO){

        return workReportService.creatDayReport(workReportDTO);
    }

    @ApiOperation("查看日报详情")
    @GetMapping("dayDetail")
    public JsonData dayDetail(@ApiParam(value = "工作报告id") @RequestParam(value = "id") Long id){

        return workReportService.dayDetail(id);
    }

    @ApiOperation("添加工作周报")
    @PostMapping("creatWeekReport")
    public JsonData creatWeekReport(@ApiParam(value = "工作报告对象") @RequestBody WorkReportDTO workReportDTO){

        return workReportService.creatWeekReport(workReportDTO);
    }

    @ApiOperation("查看周报详情")
    @GetMapping("weekDetail")
    public JsonData weekDetail(@ApiParam(value = "工作报告id") @RequestParam(value = "id") Long id){

        return workReportService.weekDetail(id);
    }

    @ApiOperation("添加工作月报")
    @PostMapping("creatMonthReport")
    public JsonData creatMonthReport(@ApiParam(value = "工作报告对象") @RequestBody WorkReportDTO workReportDTO){

        return workReportService.creatMonthReport(workReportDTO);
    }

    @ApiOperation("查看月报详情")
    @GetMapping("monthDetail")
    public JsonData monthDetail(@ApiParam(value = "工作报告id") @RequestParam(value = "id") Long id){

        return workReportService.monthDetail(id);
    }

    @ApiOperation("增加抄送")
    @PostMapping("addCC")
    public JsonData addCC(@ApiParam(value = "工作报告id") @RequestParam(value = "id") Long id,
                      @ApiParam(value = "用户id") @RequestParam(value = "userId") String userId){

        return workReportService.addCCTo(id,userId);
    }

    @ApiOperation("获取工作/任务导入列表")
    @GetMapping("getWorkOrderImportList")
    public JsonData getWorkOrderImportList(){

        return workReportService.getWorkOrderImportList();
    }

    @ApiOperation("未达标/不合格")
    @PostMapping("notStandard")
    public JsonData notStandard(@ApiParam(value = "工作报告对象") @RequestBody WorkReportDTO workReportDTO){

        return workReportService.notStandard(workReportDTO);
    }

    @ApiOperation("达标/合格")
    @PostMapping("standard")
    public JsonData standard(@ApiParam(value = "工作报告对象") @RequestBody WorkReportDTO workReportDTO){

        return workReportService.standard(workReportDTO);
    }
}

